package ru.usu.gv.utils.generators;

import ru.usu.gv.core.I18nService;
import ru.usu.gv.graph.Graph;
import ru.usu.gv.gui.component.GVIntegerField;
import ru.usu.gv.utils.RandomUtilities;

import javax.swing.JPanel;

/**
 @author Sergey Pupyrev 
 14.05.2007
 */

public class Grid3DGenerator extends GraphGeneratorBase
{
	public String getTitle()
	{
		return I18nService.get("generator.grid3D");
	}

	public Graph generate(JPanel panel)
	{
		GVIntegerField width = (GVIntegerField) panel.getComponent(0);
		GVIntegerField height = (GVIntegerField) panel.getComponent(1);
		GVIntegerField depth = (GVIntegerField) panel.getComponent(2);

		return RandomUtilities.generateGrid3d(width.getValue(), height.getValue(), depth.getValue());
	}

	@Override
	public void customizePanel(JPanel panel)
	{
		super.customizePanel(panel);

		GVIntegerField width = new GVIntegerField(I18nService.get("generator.grid3D.width"), 10, true);
		GVIntegerField height = new GVIntegerField(I18nService.get("generator.grid3D.height"), 10, true);
		GVIntegerField depth = new GVIntegerField(I18nService.get("generator.grid3D.depth"), 10, true);

		panel.add(width);
		panel.add(height);
		panel.add(depth);
	}

}
